#include"BoyStudent.h"
#include"GirlStudent.h"
#include"StudentArray.h"
#include"ChargeMoney.h"
#include<iostream>
using namespace std;
int main()
{
	Student *pStu1 = new BoyStudent("Tom", 50);
	Student *pStu2 = new GirlStudent("Mary", 40);
	Student *pStu3 = new BoyStudent("John", 60);

	IVisitor *pVisitor = new ChargeMoney();
	StudentArray *pArr = new StudentArray();
	pArr->SetVisitor(pVisitor);
	pArr->Attach(pStu1);
	pArr->Attach(pStu2);
	pArr->Attach(pStu3);

	pArr->AllPayMoney();
	cout<<"****************************"<<endl;
	pArr->Detach(pStu2);
	pArr->AllPayMoney();

	delete pArr;
	delete pVisitor;

	cin.get();
	return 0;
}